<template>
    <div>
        <div class="nav pd">
            <div class="iconBox">
                <i class="iconfont icon-icon4" @click="toHome"></i>
            </div>
            <div class="iconBox">
                <i class="iconfont icon-xihuan1 like" @click="Like" :class="isLike ? 'active' : ''" v-if="likeShow"></i>
                <img src="../assets/img/avater.jpg" alt="" @click="toAbout">
            </div>
        </div>
    </div>
</template>

<script>
import { useRouter } from 'vue-router'
export default {
    props: {
        isLike: {
            type: Boolean,
            default: false
        },
        likeShow: {
            type: Boolean,
            default: false
        }
    },
    emits: ['Like'],
    setup(props, context) {
        const router = useRouter()
        const toHome = () => {
            router.push('/')
        }
        const Like = () => {
            context.emit('Like')
        }
        const toAbout = () => {
            router.push('/about')
        }
        return {
            toHome,
            Like,
            toAbout
        }
    }
}
</script>

<style scoped lang="scss">
.pd{
    padding: 0 20px;
}
.nav{
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e6e6e6;
    position: fixed;
    top: 0;
    left: 0;
    right: 6px;
    background-color: #fff;
    img{
        width: 30px;
        height: 30px;
        cursor: pointer;
    }
    .iconBox{
        i{
            font-size: 30px;
            color: #92817a;
            cursor: pointer;
            &:nth-child(1) {
                margin-right: 10px;
            }
        }
        .like{
            font-size: 26px;
            &:hover{
                color: red;
            }
        }
        .active{
            color: red;
        }
    }
}

@media screen and (max-width: 768px) {
    .nav{
        i{
            font-size: 24px;
        }
    }
}
</style>